home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Dev / misc / temgen.lha / Temgen / tg-0.11 / sample / class / classdef.tg < prev    next >
Text File  |  2002-12-18  |  1KB  |  63 lines

  1. #
  2. #  simple C++ example
  3. #
  4.  
  5. #
  6. #   class    - open class declaration
  7. #########################################################
  8.  
  9. @function class( name )
  10.  
  11. @   emit  $name + ".Header"
  12. class $name {
  13.     private:
  14. @      embed $name + ".p"
  15.     public:
  16. @      embed $name + "."    
  17. };
  18.  
  19. @output( $name + ".h" )
  20. \#ifndef __$name\_h_
  21. \#define __$name\_h_
  22.  
  23. @   embed  $name + ".Header"
  24.  
  25. \#endif
  26.  
  27. @output( $name + ".cc" )
  28. \#include \"$name\.h\"    
  29.  
  30. @   embed  $name + ".Body"
  31.  
  32. @endfunction
  33.  
  34.  
  35. #
  36. #   private    - make private method
  37. #########################################################
  38. @function private( class, typ, proto )
  39. @    emit  $class + ".p"
  40.               $typ   $proto ;
  41. @    emit  $class + ".Body"
  42. $typ $class::$proto
  43. {
  44. @    embed  $class + ".Fun." + $typ + ":" + $proto    
  45. }
  46. @    emit   $class + ".Fun." + $typ + ":" + $proto    
  47. @endfunction
  48.  
  49. #
  50. #   public     - make public method
  51. #########################################################
  52. @function public( class, typ, proto )
  53. @    emit  $class + "."
  54.               $typ   $proto ;
  55. @    emit  $class + ".Body"
  56. $typ $class::$proto
  57. {
  58. @    embed  $class + ".Fun." + $typ + ":" + $proto    
  59. }
  60. @    emit   $class + ".Fun." + $typ + ":" + $proto    
  61. @endfunction
  62.  
  63.